#pragma once

#include <vector>
using namespace std;
#include <d3d11.h>
#include <d3dx11.h>
#include <d3dcompiler.h>
#include <xnamath.h>

#ifdef _DEBUG
#define CHECKHR(x) \
	if ((hr = (x)) != S_OK) \
	{ \
	FAILHR(#x, hr); \
	_ASSERT(hr == S_OK); \
	return hr; }
#else
#define CHECKHR(x) \
	if ((hr = (x)) != S_OK) \
	return hr;
#endif

#define CHECKARGV(x) \
	ASSERT(x); \
	if ((x) == false) { \
	return; }
#define CHECKARG(x) \
	ASSERT(x); \
	if ((x) == false) { \
	return E_INVALIDARG; }

#ifdef _DEBUG
#define ASSERT(x) \
if ((x) == false) \
{ \
FAIL(#x); \
_CrtDbgBreak(); \
}
#else
#define ASSERT(x)
#endif

#define FAIL(x) \
	if (Log) \
	{ \
	Log->Out("\n=====================================\nApplication has failed:\nFile: %s\nLine: %d\nExpression: %s\n", __FILE__, __LINE__, x); \
	}
#define FAILHR(x, hr) \
	if (Log) \
	{ \
	Log->Out("\n=====================================\nApplication has failed:\nFile: %s\nLine: %d\nExpression: %s\nHRESULT: %x\n", __FILE__, __LINE__, x, hr); \
	}

#define SAFERELEASE(x) ASSERT(x); if (x != NULL) x->Release(); x = NULL;
#define MAX_STRING_LENGTH 256

#include "Lockable.h"
#include "Singleton.h"
#include "LogSystem.h"
#include "StdLog.h"
typedef unsigned int SignalCode;
typedef unsigned int ObjectId;
#include "GameObject.h"
#include "GfxHelper.h"
#include <tinyxml.h>

